package com.bdqn.tour.servlet.Yml;

import com.bdqn.tour.service.CityService;
import com.bdqn.tour.service.impl.CityServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ymlDeleteUserInfo")
public class Ymldelete extends HttpServlet {
    //创建service对象
    CityService cityService = new CityServiceimpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置编码
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        int id = Integer.parseInt(req.getParameter("id"));
        //调用service方法
        int row = cityService.YmlDelete(id);
        //返回结果
        resp.getWriter().print(row);
        resp.getWriter().close();
    }
}
